package com.utils;

import java.io.FileOutputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class PoiCreateExcel {

    public static void main(String[] args) throws Exception {
        Dowload(5);

    }




    public static void Dowload(int culumeSize) throws Exception {
        // 创建Excel的工作书册 Workbook,对应到一个excel文档
        HSSFWorkbook wb = new HSSFWorkbook();
        // 创建Excel的工作sheet,对应到一个excel文档的tab
        HSSFSheet sheet = wb.createSheet("sheet1");
        // 创建Excel的sheet的一行
        HSSFRow row = sheet.createRow(0);
        for (int i=0;i<culumeSize;i++){
            // 创建一个Excel的单元格
            HSSFCell cell = row.createCell(i);
            cell.setCellValue("hello world");
        }
        // FileOutputStream os = new FileOutputStream("D:\\report\\workbook.xls");
        FileOutputStream os = new FileOutputStream("/home/yzq/Desktop/excel/workbook.xls");
        wb.write(os);
        os.close();
    }



}